/* WARNING!!  This message format is in pre-alpha development.  There is a high
 * probability any of these formats will change, which will cause prior
 * versions to no longer work.  You are more than welcome to setup to help us
 * develop and/or test, but it is NOT recommend you use the server or message
 * formats for production purposes until we at least reach beta development.
 * Thank you.
 */

syntax = "proto3";
import "person.proto";
import "time.proto";


/* Project:
 *   uri: Eventually, I think I want this to be the webpage of the
 * server's web client that points to the project's main page (e.g. 
 * example.org/user/project_name).  For now, for testing purposes we can use
 * something like 'testserver1/project_name' until we nail down person and
 * server web client implementations.
 *   contributers: A list of person uris and their ContributionType.
 */


message Project {
	string uri = 1;
	ProjectType type = 2;
	string name = 3;
	string copyright_date = 4;
	string copyright_license = 5;
	repeated Contributer contributers = 6;
	repeated TimeSignature time_signatures = 7;
	repeated Tempo tempos = 8;
	repeated Marker markers = 9;
	uint32 sample_rate = 10;
	uint32 bit_depth = 11;
}


/* TimeSignature: Also known as meter.  Examples:  3/4, 4/4, 6/8. */
message TimeSignature {
	uint32 beats_per_measure = 1;
	uint32 note_value = 2;			// quarter note = 4, eighth note = 8, etc.
	Time start_time = 3;
	Time end_time = 4;
}


/* Tempo: aka BPM.  Though typically expressed as an integer (e.g. 140 bpm),
 * some DAWs allow a float (e.g. 140.038 bpm).  Therefore, represented as a
 * float across the board. */

message Tempo {
	float bpm = 1;
	Time start_time = 2;
	Time end_time = 3;
	TempChangeType change_type = 4;
	Time change_start_time = 5; // What time to start ramp to new tempo
}


/* Marker: This is a way to mark a part of a project, even start time, end
 * time, loop/punch points, verse/chorus, etc.) as reference points. */

message Marker {
	MarkerType type = 1;
	Time time = 2;
	string text = 3;		// Used for GenericMarker
}




/* ProjectType: Identifies what type the project is (e.g. audio, video, ?) */
enum ProjectType {
	Audio = 0;
	Video = 1;
}


/* TempChangeType: Some DAWs allow the user to gradually change from one tempo
 * to another by "ramping" to the new tempo.  This identifies if the change is
 * fixed (changes immediately) or ramped. */

enum TempoChangeType {
	Fixed = 0;
	Ramped = 1;
}


/* MarkerType: Identifies the type of marker that is being referenced.  Some
 * DAWs may treat some of these Marker Types in different ways. */

enum MarkerType {
	GenericMarker = 0;
	TrackStart = 1;
	TrackEnd = 2;
	LoopStart = 3;
	LoopEnd = 4;
	PunchIn = 5;
	PunchOut = 6;
}
